Telegram Group & Telegram Channel
⚡️ Команда дня: std::string_view

Работа со строками часто сопровождается лишними копированиями при передаче в функции, что негативно влияет на производительность.

std::string_view — невладеющее представление последовательности символов, которое избавляет от ненужных копирований строк.


🔴 До:

bool startsWith(const std::string& str, const std::string& prefix) {
return str.substr(0, prefix.length()) == prefix;
}



🟢 После:

bool startsWith(std::string_view str, std::string_view prefix) {
return str.substr(0, prefix.length()) == prefix;
}



❗️Примеры использования:

• Функции, принимающие строки для чтения
• Парсинг строк без копирования
• Работа с подстроками без создания новых объектов std::string


💡 Заменили уже const std::string& на std::string_view в своем коде?

Библиотека C/C++ разработчика #буст



tg-me.com/cppproglib/5764
Create:
Last Update:

⚡️ Команда дня: std::string_view

Работа со строками часто сопровождается лишними копированиями при передаче в функции, что негативно влияет на производительность.

std::string_view — невладеющее представление последовательности символов, которое избавляет от ненужных копирований строк.


🔴 До:

bool startsWith(const std::string& str, const std::string& prefix) {
return str.substr(0, prefix.length()) == prefix;
}



🟢 После:

bool startsWith(std::string_view str, std::string_view prefix) {
return str.substr(0, prefix.length()) == prefix;
}



❗️Примеры использования:

• Функции, принимающие строки для чтения
• Парсинг строк без копирования
• Работа с подстроками без создания новых объектов std::string


💡 Заменили уже const std::string& на std::string_view в своем коде?

Библиотека C/C++ разработчика #буст

BY Библиотека C/C++ разработчика | cpp, boost, qt


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/cppproglib/5764

View MORE
Open in Telegram


Библиотека C C разработчика | cpp boost qt Telegram | DID YOU KNOW?

Date: |

A project of our size needs at least a few hundred million dollars per year to keep going,” Mr. Durov wrote in his public channel on Telegram late last year. “While doing that, we will remain independent and stay true to our values, redefining how a tech company should operate.

What Is Bitcoin?

Bitcoin is a decentralized digital currency that you can buy, sell and exchange directly, without an intermediary like a bank. Bitcoin’s creator, Satoshi Nakamoto, originally described the need for “an electronic payment system based on cryptographic proof instead of trust.” Each and every Bitcoin transaction that’s ever been made exists on a public ledger accessible to everyone, making transactions hard to reverse and difficult to fake. That’s by design: Core to their decentralized nature, Bitcoins aren’t backed by the government or any issuing institution, and there’s nothing to guarantee their value besides the proof baked in the heart of the system. “The reason why it’s worth money is simply because we, as people, decided it has value—same as gold,” says Anton Mozgovoy, co-founder & CEO of digital financial service company Holyheld.

Библиотека C C разработчика | cpp boost qt from us


Telegram Библиотека C/C++ разработчика | cpp, boost, qt
FROM USA